import {createRouter, createWebHashHistory, createWebHistory} from 'vue-router'
import HomeView from '@/views/HomeView.vue'
import SearchView from '@/views/SearchView.vue'
import NotFind from '@/views/NotFind.vue'
const router = createRouter({
  //配置路由模式：默认是hash模式还有history模式
  //hash 路径中带#
  history: createWebHashHistory(),
  // history:createWebHistory(), //路径中不带#
  

  routes: [
    
    //路径重定向
  {path:'/',redirect:'/home'},
    { name:'home', path: '/home', component: HomeView },
    //动态路由传参
    { name: 'search', path: '/search/:words?', component: SearchView },
    
    //404
    { path:'/:catchAll(.*)',component:NotFind}
  ]
})

export default router